package com.jacobson.huobi.mvp

import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import com.jacobson.core.base.Immersive
import com.jacobson.core.di.components.AppComponent
import com.jacobson.core.di.modules.ActivityModule
import com.jacobson.core.mvp.BaseMvpActivity
import com.jacobson.huobi.R
import com.jacobson.huobi.di.components.DaggerAboutCeluerenActivityComponent
import com.jacobson.huobi.di.components.DaggerEditPasswordActivityComponent
import com.jacobson.huobi.di.modules.AboutCeluerenActivityModule
import com.jacobson.huobi.di.modules.EditPasswordActivityModule
import com.jacobson.huobi.mvp.contract.AboutCeluerenContract
import com.jacobson.huobi.mvp.contract.EditPasswordContract
import com.jacobson.huobi.utils.ResourcesUtil
import kotlinx.android.synthetic.main.activity_edit_password.*
import kotlinx.android.synthetic.main.fragment_currency.*

@Immersive(fitSystemWindows = false)
class AboutCeluerenActivity :
    BaseMvpActivity<AboutCeluerenContract.Presenter>(), AboutCeluerenContract.View {

//    @field:Inject
//    lateinit var kycAuthAdapter: KycAuthAdapter

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //修改底部功能键背景色 只支持api为21及以上
        if (Build.VERSION.SDK_INT  >= Build.VERSION_CODES.LOLLIPOP) {
            window.navigationBarColor = ResourcesUtil.getColor(R.color.colorPrimary) //设定底部导航栏  同全局颜色
        }
    }
    override fun setupActivityComponent(appComponent: AppComponent) {
        DaggerAboutCeluerenActivityComponent.builder()
            .aboutCeluerenActivityModule(AboutCeluerenActivityModule(this))
            .appComponent(appComponent)
            .activityModule(ActivityModule(this))
            .build()
            .inject(this)
//        DaggerAlarmRecordActivityComponent.builder()
//            .alarmRecordActivityModule(AlarmRecordActivityModule(this))
//            .appComponent(appComponent)
//            .activityModule(ActivityModule(this))
//            .build()
//            .inject(this)
    }

    override fun initView(savedInstanceState: Bundle?): Int = R.layout.activity_about_celueren

    override fun initData(savedInstanceState: Bundle?) {
        initBtnClick()
//        with(recyclerView) {
//            layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
//            itemAnimator = DefaultItemAnimator()
////            addItemDecoration(SpaceItemDecoration(3f))
//            adapter = kycAuthAdapter
//        }
    }

    override fun onError(type: Int, extra: Any?, code: Int, message: String): Boolean {
        smartRefreshLayout.finishLoadMore()
        smartRefreshLayout.finishRefresh()
        logger.e("error >>> $message")
        return super.onError(type, extra, code, message)
    }

    private fun initBtnClick() {
//        LayoutInflater.from(this).inflate(R.layout.fragment_edit_password, null, false)
        btnBack.setOnClickListener({
            this.finish()
//            this?.overridePendingTransition( R.anim.slide_right_out,R.anim.slide_left_in)
        })

    }

    companion object {
        fun startActivity(context: Context) {
            Intent(context, AboutCeluerenActivity::class.java).run {
                context.startActivity(this)
            }
        }

    }

}
